package org.jw.testemunhopublico.repository.dao.impl;

import javax.persistence.Query;

import org.jw.testemunhopublico.repository.dao.ParametroDaoIF;
import org.jw.testemunhopublico.repository.entities.Parametro;
import org.springframework.stereotype.Repository;

@Repository
public class ParametroDao extends GenericDao<Parametro> implements ParametroDaoIF {

	private static final long serialVersionUID = 323575736354911835L;

	public Parametro findByKey(String key) {
		beginTransaction();
		Query query = manager
				.createQuery("SELECT p FROM Parametro p WHERE p.key = :key",
						Parametro.class).setParameter("key", key);
		Parametro result = (Parametro) query.getSingleResult();
		closeTransaction();

		return result;
	}

}
